const pkg = require('./package')
var configobj = new Object()
if(process.env.NODE_ENV == 'production'){
  configobj.baseurl =  'http://video.qulang.com'
  configobj.target =  'http://api.qulang.com/php/dispatcher.php'
}else if(process.env.NODE_ENV == 'testenv'){
  configobj.baseurl =  'http://videotest.qulang.com'
  configobj.target =  'http://apitest.qulang.com/php/dispatcher.php'
}else{
  configobj.baseurl =  'http://localhost:8011'
  configobj.target =  'http://apitest.qulang.com/php/dispatcher.php'
}
module.exports = {
  mode: 'spa',

  /*
  ** Headers of the page
  */
  head: {
    title: '去浪摄影-定制专属视觉盛宴',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '去浪影像，精心定制摄影服务，尊享专属视觉盛宴' },
      { hid: 'keyword', name: 'keyword', content: '商业摄影，摄影服务，活动会议 ，体育赛事 ，文艺演出，毕业典礼 ，生日宴会 ，婚礼纪实 ，产品拍摄 ，航拍' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: 'https://www.qulang.com/favicon.ico' }
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  /*
  ** Global CSS
  */
  css: [
    'element-ui/lib/theme-chalk/index.css',
    '@/assets/css/global.css'
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/element-ui',
    { src: "~plugins/axios.js", ssr: true },
    { src: '~plugins/global.js', ssr: false }
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://github.com/nuxt-community/axios-module#usage
    '@nuxtjs/axios', "@nuxtjs/proxy"
  ],
  /*
  ** Axios module configuration
  */
  axios: {
    // See https://github.com/nuxt-community/axios-module#options
    retry: { retries: 3 },
    //开发模式下开启debug
    debug: process.env.NODE_ENV == "production" ? false : true,
    //设置不同环境的请求地址
    // baseURL: process.env._ENV == "production" ? "http://video.qulang.com/business" : "http://localhost:8011/api",
     baseURL: configobj.baseurl,
    withCredentials: true,
  },

  /*
  ** proxy module configuration
  */
  proxy: {
    //开启代理
    "/api/": {
      target: configobj.target,
      pathRewrite: {"^/api": ""}
    },
  },
  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {

    }
  }
}
